class MashupsController < ApplicationController
  # GET /mashups
  # GET /mashups.xml
  def index
    @mashups = Mashup.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @mashups }
    end
  end

  # GET /mashups/1
  # GET /mashups/1.xml
  def show
    @mashup = Mashup.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @mashup }
    end
  end

  # GET /mashups/new
  # GET /mashups/new.xml
  def new
    @mashup = Mashup.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @mashup }
    end
  end

  # GET /mashups/1/edit
  def edit
    @mashup = Mashup.find(params[:id])
  end

  # POST /mashups
  # POST /mashups.xml
  def create
    @mashup = Mashup.new(params[:mashup])

    respond_to do |format|
      if @mashup.save
        flash[:notice] = 'Mashup was successfully created.'
        format.html { redirect_to(@mashup) }
        format.xml  { render :xml => @mashup, :status => :created, :location => @mashup }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @mashup.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /mashups/1
  # PUT /mashups/1.xml
  def update
    @mashup = Mashup.find(params[:id])

    respond_to do |format|
      if @mashup.update_attributes(params[:mashup])
        flash[:notice] = 'Mashup was successfully updated.'
        format.html { redirect_to(@mashup) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @mashup.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /mashups/1
  # DELETE /mashups/1.xml
  def destroy
    @mashup = Mashup.find(params[:id])
    @mashup.destroy

    respond_to do |format|
      format.html { redirect_to(mashups_url) }
      format.xml  { head :ok }
    end
  end
end
